<template>
  <!--  业务字段配置 表单 -->
  <div>
    <el-row class="bussinessEleList container">
      <el-col style="margin-right:10px;" class="content-left">
        <!-- 按钮与搜索 -->
        <el-row class="handleBox">
          <!-- 左侧按钮 -->
          <el-col :span="18">
            <el-button @click="addOrEditFunc('2')">编辑</el-button>
          </el-col>
          <!-- 右侧查询图标 -->
          <el-col :span="6">
            <div class="handleIconBox">
              <!-- 查询弹框 -->
              <el-popover placement="left-start" trigger="click" popper-class="icon_porper">
                <div class="search_porper">
                  <el-form
                    :model="searchForm"
                    ref="searchForm"
                    label-width="100px"
                    label-position="left"
                    size="mini"
                  >
                    <el-form-item label="元素字段: ">
                      <el-input v-model="searchForm.elementField" style="width:150px"></el-input>
                    </el-form-item>
                    <el-form-item label="元素名称：">
                      <el-input v-model="searchForm.elementName" style="width:150px"></el-input>
                    </el-form-item>
                  </el-form>
                  <div style="text-align:center;padding:10px">
                    <el-button size="mini" @click="searchFunc">查询</el-button>
                    <el-button
                      size="mini"
                      @click="
                        (searchForm.elementField = ''), (searchForm.elementName = '')
                      "
                    >重置</el-button>
                  </div>
                </div>
                <i class="iconfont icon-sousuo" title="搜索" slot="reference"></i>
              </el-popover>
              <!-- 显示隐藏弹框 -->
              <el-popover placement="bottom" width="150" trigger="click" popper-class="icon_porper">
                <div class="operation_checkbox">
                  <el-checkbox-group v-model="checkList">
                    <el-checkbox
                      v-for="item in textData"
                      :key="item.prop"
                      :label="item.label"
                      :disabled="item.checkDisabled"
                    >{{ item.label }}</el-checkbox>
                  </el-checkbox-group>
                </div>
                <i class="iconfont icon-liebiaoshezhi" title="列表设置" slot="reference"></i>
              </el-popover>
            </div>
          </el-col>
        </el-row>

        <!-- 列表 -->
        <el-table
          ref="multipleTable"
          :data="tableData"
          class="buessinessEleTable"
          style="width: 100%"
          @row-click="rowClick"
        >
          <el-table-column width="55" type="selection"  />

          <el-table-column
            prop="elementField"
            label="元素字段"
            v-if="columnState[0]"
            show-overflow-tooltip
          ></el-table-column>

          <el-table-column
            prop="fieldName"
            label="数据库字段 "
            v-if="columnState[1]"
            show-overflow-tooltip
          ></el-table-column>

          <el-table-column
            prop="elementName"
            label="元素名称"
            v-if="columnState[2]"
            show-overflow-tooltip
          ></el-table-column>

          <el-table-column
            prop="elementType"
            label="类型 "
            v-if="columnState[3]"
            show-overflow-tooltip
            :formatter="row => this.$getLabel(row.elementType,this.ftp_businessEle_type)"
          ></el-table-column>

          <el-table-column
            prop="dimensionCode"
            label="维度"
            v-if="columnState[4]"
            show-overflow-tooltip
            :formatter="row => this.$getLabel(row.dimensionCode,this.cpm_dimension_type)"
          ></el-table-column>

          <el-table-column
            prop="pricingFlag"
            label="可用于定价方法 "
            v-if="columnState[5]"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span v-if="scope.row.pricingFlag==1" style="color:red">是</span>
              <span v-if="scope.row.pricingFlag==0">否</span>
            </template>
          </el-table-column>

          <el-table-column
            prop="curveFlag"
            label="可用于定价曲线 "
            v-if="columnState[6]"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span v-if="scope.row.curveFlag==1" style="color:red">是</span>
              <span v-if="scope.row.curveFlag==0">否</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="adjFlag"
            label="可用于调整项规则 "
            align="center"
            v-if="columnState[7]"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span v-if="scope.row.adjFlag==1" style="color:red">是</span>
              <span v-if="scope.row.adjFlag==0">否</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="bfcFlag"
            label="可用于BreakFunding/BreakCharge规则"
            align="center"
            v-if="columnState[8]"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span v-if="scope.row.adjFlag==1" style="color:red">是</span>
              <span v-if="scope.row.adjFlag==0">否</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="groupFlag"
            label="可用于组合定价规则 "
            v-if="columnState[9]"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span v-if="scope.row.adjFlag==1" style="color:red">是</span>
              <span v-if="scope.row.adjFlag==0">否</span>
            </template>
          </el-table-column>

          <el-table-column
            prop="editFlag"
            label="是否内置 "
            v-if="columnState[10]"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              <span v-if="scope.row.editFlag==0" style="color:red">是</span>
              <span v-if="scope.row.editFlag==1">否</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="creator"
            label="创建人 "
            v-if="columnState[11]"
            :formatter="row => row.creator || '-'"
            show-overflow-tooltip
          ></el-table-column>

          <el-table-column
            prop="createdTm"
            label="创建时间 "
            v-if="columnState[12]"
            show-overflow-tooltip
            :formatter="formatterTime"
          ></el-table-column>

          <el-table-column
            prop="modifier"
            label="修改人 "
            v-if="columnState[13]"
            :formatter="row => row.modifier || '-'"
            show-overflow-tooltip
          ></el-table-column>

          <el-table-column
            prop="modifiedTm"
            label="修改时间 "
            v-if="columnState[14]"
            :formatter="formatterTime"
            show-overflow-tooltip
          ></el-table-column>
        </el-table>
        <!-- 分页插件 -->
        <pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="searchForm.page"
          :page-size="searchForm.size"
          @refresh="searchFunc"
          :total="total"
        ></pagination>
      </el-col>
    </el-row>

    <!-- 编辑页面 -->
    <el-dialog v-dialogDrag title="编辑字段用途配置" :visible.sync="addOrEdit" width="880px">
      <el-form
        :model="saveForm"
        ref="businessEleSaveForm"
        label-width="280px"
        label-position="left"
        :rules="saveFormRules"
      >
        <el-row>
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="元素字段: " prop="elementField">
              <el-input v-model="saveForm.elementField" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">该字段不可编辑</div>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="元素名称: " prop="elementName">
              <el-input v-model="saveForm.elementName" maxlength="40" placeholder="请输入元素名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan"></el-col>
        </el-row>
        <!--  内置-->
        <el-row v-if="saveForm.editFlag == '0'">
          <el-row>
            <el-col :span="formSpanAdj.itemSpan">
              <el-form-item label="元素类型：" prop="elementType">
                <el-select v-model="saveForm.elementType" style="width:100%" disabled>
                  <el-option
                    v-for="item in ftp_businessEle_type"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="formSpanAdj.msgSpan">
              <div class="tipMessage">内置字段元素类型不可编辑</div>
            </el-col>
          </el-row>
          <el-row v-if="saveForm.elementType == '4'">
            <el-col :span="formSpanAdj.itemSpan">
              <el-form-item label="维度：" prop="dimensionCode">
                <el-select v-model="saveForm.dimensionCode" style="width:100%" disabled>
                  <el-option
                    v-for="item in cpm_dimension_type"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="formSpanAdj.msgSpan">
              <div class="tipMessage">内置字段维度不可编辑</div>
            </el-col>
          </el-row>
        </el-row>
        <!-- 非内置 -->
        <el-row v-if="saveForm.editFlag == '1'">
          <el-row>
            <el-col :span="formSpanAdj.itemSpan">
              <el-form-item label="元素类型：" prop="elementType">
                <el-select v-model="saveForm.elementType" style="width:100%">
                  <el-option
                    v-for="item in ftp_businessEle_type"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="formSpanAdj.msgSpan">
              <div class="tipMessage"></div>
            </el-col>
          </el-row>
          <el-row v-if="saveForm.elementType=='4'">
            <el-col :span="formSpanAdj.itemSpan">
              <el-form-item label="字典：" prop="dimensionCode">
                <el-select v-model="saveForm.dimensionCode" style="width:100%">
                  <el-option
                    v-for="item in cpm_dimension_type"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="formSpanAdj.msgSpan">
              <div class="tipMessage">(提示：选择“类型”字段字典时，才可维护此字段)</div>
            </el-col>
          </el-row>
        </el-row>
        <!-- 非内置 结束-->
        <!-- 可用于定价曲线 开始 -->
        <el-row v-if="saveForm.pricingFlag=='0'  || !usingFlagMap.pricingFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于定价方法: " prop="pricingFlag">
              <el-select v-model="saveForm.pricingFlag" placeholder="请选择可用于定价方法" style="width:100%">
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：“是”此业务元素可在定价曲线规则模板中选择)</div>
          </el-col>
        </el-row>

        <el-row v-if="saveForm.pricingFlag=='1' && usingFlagMap.pricingFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于定价方法" prop="pricingFlag">
              <el-select
                v-model="saveForm.pricingFlag"
                placeholder="请选择可用于定价方法"
                disabled
                style="width:100%"
              >
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：此业务元素已被定价方法规则模板使用,不可编辑)</div>
          </el-col>
        </el-row>
        <!-- 可用于定价曲线 结束 -->

        <!-- 可用于定价曲线 开始 -->
        <el-row v-if="saveForm.curveFlag=='0'  || !usingFlagMap.curveFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于定价曲线" prop="curveFlag">
              <el-select v-model="saveForm.curveFlag" placeholder="请选择可用于定价曲线" style="width:100%">
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：“是”此业务元素可在定价曲线规则模板中选择)</div>
          </el-col>
        </el-row>

        <el-row v-if="saveForm.curveFlag=='1' && usingFlagMap.curveFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于定价曲线" prop="curveFlag">
              <el-select
                v-model="saveForm.curveFlag"
                placeholder="请选择可用于定价曲线"
                disabled
                style="width:100%"
              >
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：此业务元素已被定价方法规则模板使用,不可编辑)</div>
          </el-col>
        </el-row>
        <!-- 可用于定价曲线 结束 -->

        <!-- 可用于调整项规则 start -->
        <el-row v-if="saveForm.adjFlag=='0' || !usingFlagMap.adjFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于调整项规则: " prop="adjFlag">
              <el-select v-model="saveForm.adjFlag" placeholder="请选择可用于调整项规则" style="width:100%">
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：“是”此业务元素可在调整项定义的规则字段中选择)</div>
          </el-col>
        </el-row>

        <el-row v-if="saveForm.adjFlag=='1' && usingFlagMap.adjFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于调整项规则: " prop="adjFlag">
              <el-select
                v-model="saveForm.adjFlag"
                placeholder="请选择可用于调整项规则"
                disabled
                style="width:100%"
              >
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：此业务元素可在调整项定义的规则字段中使用,不可编辑)</div>
          </el-col>
        </el-row>
        <!-- 可用于调整项规则 结束 -->

        <!-- 可用于BreakFunding/BreakCharge规则 start -->
        <el-row v-if="saveForm.bfcFlag=='0' || !usingFlagMap.bfcFlag ">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于BreakFunding/BreakCharge规则: " prop="bfcFlag">
              <el-select
                v-model="saveForm.bfcFlag"
                placeholder="请选择可用于BreakFunding/BreakCharge规则"
                style="width:100%"
              >
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：“是”此业务元素可在funding/charge模板中选择)</div>
          </el-col>
        </el-row>

        <el-row v-if="saveForm.bfcFlag=='1' && usingFlagMap.bfcFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于BreakFunding/BreakCharge规则: " prop="bfcFlag">
              <el-select
                v-model="saveForm.bfcFlag"
                placeholder="请选择可用于BreakFunding/BreakCharge规则"
                disabled
                style="width:100%"
              >
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：此业务元素可在funding/charge模板中使用,不可编辑)</div>
          </el-col>
        </el-row>
        <!-- 可用于BreakFunding/BreakCharge规则 结束 -->

        <!--可用于组合定价规则 start -->
        <el-row v-if="saveForm.groupFlag=='0' || !usingFlagMap.groupFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于组合定价规则: " prop="groupFlag">
              <el-select v-model="saveForm.groupFlag" placeholder="请选择可用于组合定价规则" style="width:100%">
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：“是”此业务元素可在组合定价模板中选择)</div>
          </el-col>
        </el-row>

        <el-row v-if="saveForm.groupFlag=='1' &&  usingFlagMap.groupFlag">
          <el-col :span="formSpanAdj.itemSpan">
            <el-form-item label="可用于组合定价规则: " prop="groupFlag">
              <el-select v-model="saveForm.groupFlag" placeholder="请选择可用于组合定价规则" style="width:100%">
                <el-option
                  v-for="item in statusList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="formSpanAdj.msgSpan">
            <div class="tipMessage">(提示：此业务元素可在组合定价模板中使用,不可编辑)</div>
          </el-col>
        </el-row>
        <!-- 可用于组合定价规则 结束 -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="saveFunc">确 定</el-button>
        <el-button @click="addOrEdit = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import onlyOneSearch from "@/components/onlyOneSearch";
import { getDict } from "@/api/getDict";
import moment from "moment";
import { businessEleApiMap } from "@/api/index";
export default {
  //定义数据
  data() {
    let self = this;
    return {
      operateType:"",
      //查询时默认条件
      searchForm: {
        page: 1,
        size: 15,
        elementField: "",
        elementName: ""
      },
      //数据总条数
      total: 0,
      //表单元素过滤
      textData: [
        {
          prop: "elementField",
          label: "元素字段",
          checkDisabled: true
        },
        {
          prop: "fieldName",
          label: "数据库字段",
          checkDisabled: true
        },
        {
          prop: "elementName",
          label: "元素名称",
          checkDisabled: false
        },
        {
          prop: "elementType",
          label: "类型",
          checkDisabled: false
        },
        {
          prop: "dimensionCode",
          label: "维度",
          checkDisabled: false
        },
        {
          prop: "pricingFlag",
          label: "可用于定价方法",
          checkDisabled: false
        },
        {
          prop: "curveFlag",
          label: "可用于定价曲线",
          checkDisabled: false
        },
        {
          prop: "adjFlag",
          label: "可用于调整项规则",
          checkDisabled: false
        },
        {
          prop: "bfcFlag",
          label: "可用于BreakFunding/BreakCharge规则",
          checkDisabled: false
        },
        {
          prop: "groupFlag",
          label: "可用于组合定价规则",
          checkDisabled: false
        },
        {
          prop: "editFlag",
          label: "是否内置",
          sortable: true,
          checkDisabled: false
        },
        {
          prop: "creator",
          label: "创建人",
          checkDisabled: false
        },
        {
          prop: "createdTm",
          label: "创建时间",
          checkDisabled: false
        },
        {
          prop: "modifier",
          label: "修改人",
          checkDisabled: false
        },
        {
          prop: "modifiedTm",
          label: "修改时间",
          checkDisabled: false
        }
      ],
      //表数据
      tableData: [],
      //双向绑定 选择表单展示字段
      checkList: [],
      //字段用途类型字典
      ftp_businessEle_type: [],
      //维度字典
      cpm_dimension_type: [],
      //控制编辑框
      addOrEdit: false,
      //定价状态
      statusList: [
        { value: "1", label: "是" },
        { value: "0", label: "否" }
      ],
      //是否内置
      editFlagstatusList: [
        { value: "1", label: "否" },
        { value: "0", label: "是" }
      ],
      //规则校验
      saveForm: {},
      //是否可用标志
      usingFlagMap: {
        curveFlag: false,
        pricingFlag: false,
        adjFlag: false,
        bfcFlag: false,
        groupFlag: false
      },
      saveFormRules: {
        elementField: [
          { required: true, message: "元素字段", trigger: "blur" }
        ],
        elementName: [
          { required: true, message: "该输入项为必输项", trigger: "blur" },
          ,
          { validator: this.currencyCodeValid, trigger: "blur" }
        ],
        elementType: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ],
        pricingFlag: [
          { required: true, message: "请选择定价方法", trigger: "blur" }
        ],
        curveFlag: [
          { required: true, message: "请选择定价方法", trigger: "blur" }
        ],
        adjFlag: [
          { required: true, message: "请选择定价方法", trigger: "blur" }
        ],
        bfcFlag: [
          { required: true, message: "请选择定价方法", trigger: "blur" }
        ],
        groupFlag: [
          { required: true, message: "请选择定价方法", trigger: "blur" }
        ],
        editFlag: [
          { required: true, message: "请选择定价方法", trigger: "blur" }
        ]
      },
      //form表单占比
      formSpanAdj: {
        itemSpan: 14,
        msgSpan: 10
      }
    };
  },
  //组件引入
  components: {},
  //创建初始化
  created() {
    this.checkListInit();
    this.getDict("ftp_businessEle_type");
    this.getDict("cpm_dimension_type");
  },
  mounted() {
    this.searchFunc();
  },
  //监控数值变化
  watch: {},
  //运算
  computed: {
    columnState() {
      let arr = [],
        arr1 = this.textData,
        arr2 = this.checkList;
      for (let i = 0; i < arr1.length; i++) {
        let flg = false;
        for (let j = 0; j < arr2.length; j++) {
          if (arr1[i].label === arr2[j]) {
            flg = true;
          }
        }
        arr.push(flg);
      }
      return arr;
    }
  },
  methods: {
    //增改查
    addOrEditFunc(operateType) {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行编辑");
      }
      this.operateType = operateType;
      //首先清空缓存数据
      this.saveForm = {};
      //给数据赋值
      this.saveForm = selection[0];
      //控制表单显示
      this.addOrEdit = true;
    },
    //查询
    searchFunc() {
      let data = this.searchForm;
      businessEleApiMap.findAll(data).then(res => {
         console.log(res, "字段配置数据");
        if (res.code == 200) {
          this.tableData = res.rows;
          console.log(this.tableData, "字段配置数据");
          this.total = res.total;
        }
      });
    },
    checkListInit() {
      this.checkList = this.textData.map(v => {
        return v.label;
      });
    },
    //事件转换
    formatterTime(row, column) {
      let ele = row[column.property];
      if (ele) return moment(ele).format("YYYY-MM-DD HH:mm:ss");
      else return "-";
    },
    // 行点击事件
    rowClick(row) {
      if (this.$refs.multipleTable) {
        this.$refs.multipleTable.clearSelection();
      }
      this.$refs.multipleTable.toggleRowSelection(row, true);
    },
    //页码值改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.searchForm.size = val;
      this.searchFunc();
    },
    //当前页改变
    handleCurrentChange(val) {
      this.searchForm.page = val;
      console.log(`当前页: ${val}`);
      this.searchFunc();
    },
    //获取字段数据
    getDict(data) {
      getDict(data).then(res => {
        if ((res.code = 200)) {
          this[data] = res.datas;
        } else {
          this.$message.warning("数据查询错误");
        }
      });
    },
    //保存字段用途表单
    saveFunc() {
      //验证表单
      this.$refs.businessEleSaveForm.validate(valid =>{
          if(valid){
              let saveData = {...this.saveForm}
            //首先判断如果非字典,需要清空数据
            if(saveData.elementType !=4){
                this.$set(saveData,"dimensionCode","");
            }
            //组装数据
            let params = {
              operateType:this.operateType,
              businessEle:saveData
            };
            businessEleApiMap.save(params).then(res=>{
                if(res.code ==200 && res.data =='1'){
                    this.$message.success(res.message);
                    //刷新
                    this.searchFunc();
                }else{
                  this.$message.error("字段用途保存失败")
                }
                this.addOrEdit=false;
            })
            .catch(err=>{
              console.log(err);
            });
          }
      });
    },


  }
};
</script>


<style lang="scss" scoped>
/deep/.el-dialog__body {
  max-height: 400px;
}
.tipMessage {
  line-height: 32px;
  margin-left: 5px;
  color: red;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 500 !important;
  font-size: 12px !important;
}
</style>